<?php
/**
 * LangAction.class.php     语言包管理操作类
 *
 * @author                  mashanling(msl-138@163.com)
 * @date                    2012-07-03 17:34:29
 * @last modify             2012-09-20 20:50:20 by mashanling
 */

!defined('ROOT') && exit('Access Denied');

class LangAction extends CommonAction {
    protected $init_model = false;//是否实例对应模型

    /**
     * 生成语言包js
     *
     * @author       mashanling
     * @date         2012-07-04 08:35:38
     * @last modify  2012-09-20 20:50:29 by mashanling
     *
     * @return void 无返回值
     */
    function create() {
        require_cache(EXTEND_PATH . 'Functions/function.dir.php');
        create_dir(WEB_LANG_PATH);
        $lang_arr = scand_dir(LANG_PATH);//语言包

        foreach ($lang_arr as $k => $v) {
            $lang     = array();

            foreach ($v as $file) {
                $lang = array_merge($lang, array_change_key_case(include($file), CASE_UPPER));
            }

            array2js($lang, 'L', WEB_LANG_PATH . $k . '.js');
        }
    }
}